#ifndef __P_TENGINE_H__
#define __P_TENGINE_H__

#include "p_lexer.h"

// struct/class forward definitions...
struct p_template_engine_struct;

// typedefs...
typedef p_template_engine_struct* p_template_engine_struct_ptr;

/**
 * This is the main template engine structure which stores all the necessary information.
 *
 * @brief The template engine structure
 */
struct p_template_engine_struct
{
   p_token_struct_list_ptr token_list; // ATTENTION: This is a shared list and is not deleted here.
   p_unsigned_int index; // This is the index which is used for navigating through the tokens.
};

/**
 * The standard constructor for the template_engine_struct.
 */
p_template_engine_struct template_engine_struct_create();

/**
 * This is the copy constructor for the template_engine_struct.
 *
 * @param template_engine_struct The structure which is copied.
 */
p_template_engine_struct
         template_engine_struct_create(
                                       const p_template_engine_struct &template_engine_struct);

/**
 * This is an init function for the template engine. Constructors won't call this function automatically.
 *
 * @param template_engine_struct A pointer to a template_engine_struct.
 */
void
         template_engine_struct_init(
                                     p_template_engine_struct_ptr template_engine_struct);

/**
 * This is the main function for the template engine, which is a quite complex
 * function and preprocessor like language. The template language is a functional style language, which can
 * be used for meta-programming in a much better way than c++.
 *
 * @brief The main function for the template engine.
 * @param template_engine_struct This structure stores all necessary information for the template engine.
 * @param token_list The input token list which is used by the parser.
 * @param index This is the starting index for the parse and interpreter of the engine.
 * @return The function returns a string containing the result of the engine. This result might be parsed by a lexer.
 */
std::string
template_engine_run(p_template_engine_struct_ptr template_engine_struct,
                    p_token_struct_list_ptr token_list,const p_unsigned_int &index);

#endif
